<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="团号" prop="number
s">
        <el-input v-model="queryParams.numbers" placeholder="请输入团号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="线路名称" prop="lineNames">
        <el-input v-model="queryParams.lineNames" placeholder="请输入线路名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="线路id" prop="lineId">
        <el-input v-model="queryParams.lineId" placeholder="请输入线路id" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="业务类型" prop="type">
        <el-select v-model="queryParams.type" placeholder="请选择业务类型" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="组团联系人" prop="blocksName">
        <el-input v-model="queryParams.blocksName" placeholder="请输入组团联系人" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="抵达日期" prop="arriveDate">
        <el-date-picker v-model="queryParams.arriveDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="抵达时间" prop="arriveTime">
        <el-date-picker v-model="queryParams.arriveTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="返程日期" prop="returnDate">
        <el-date-picker v-model="queryParams.returnDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="返程时间" prop="returnTime">
        <el-date-picker v-model="queryParams.returnTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
                   v-hasPermi="['team:orde:create']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
                   v-hasPermi="['team:orde:export']">导出</el-button>
      </el-col>
              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

      <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <!-- <el-table-column label="团队id" align="center" prop="id" /> -->
      <el-table-column label="团号" align="center" prop="numbers" />
      <el-table-column label="线路名称" align="center" prop="lineNames" />
     <!-- <el-table-column label="线路id" align="center" prop="lineId" /> -->
      <!-- <el-table-column label="业务类型" align="center" prop="type" />
      <el-table-column label="团说明" align="center" prop="teamRemark" />
      <el-table-column label="组团社" align="center" prop="blocks" /> -->
      <el-table-column label="组团联系人" align="center" prop="blocksName" />
      <el-table-column label="k" align="center" prop="k" />
      <el-table-column label="抵达日期" align="center" prop="arriveDate" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.arriveDate) }}</span>
        </template>
      </el-table-column>
     <!-- <el-table-column label="抵达交通" align="center" prop="arriveTraffic" />
      <el-table-column label="抵达班次" align="center" prop="arriveClasses" />
      <el-table-column label="抵达时间" align="center" prop="arriveTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.arriveTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="抵达站点/机场" align="center" prop="arriveSite" />
      <el-table-column label="抵达订票方式" align="center" prop="arriveBooking" />
      <el-table-column label="抵达城市" align="center" prop="arriveCity" />
      <el-table-column label="抵达跨天数" align="center" prop="arriveDays" />
      <el-table-column label="抵达备注" align="center" prop="arriveRemark" />
      <el-table-column label="返程日期" align="center" prop="returnDate" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.returnDate) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="返程交通" align="center" prop="returnTraffic" />
      <el-table-column label="返程班次" align="center" prop="returnClasses" />
      <el-table-column label="返程时间" align="center" prop="returnTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.returnTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="返程站点/机场" align="center" prop="returnSite" />
      <el-table-column label="返程订票方式" align="center" prop="returnBooking" />
      <el-table-column label="返程城市" align="center" prop="returnCity" />
      <el-table-column label="返程跨天数" align="center" prop="returnDays" />
      <el-table-column label="抵达备注" align="center" prop="returnRemark" />
      <el-table-column label="全陪/客人" align="center" prop="guestName" />
      <el-table-column label="电话" align="center" prop="guestPhone" />
      <el-table-column label="成人人数" align="center" prop="guestAdult" />
      <el-table-column label="儿童人数" align="center" prop="guestChildren" />
      <el-table-column label="全陪人数" align="center" prop="guestAccompany" />
      <el-table-column label="定金" align="center" prop="deposit" />
      <el-table-column label="代收" align="center" prop="collecting" />
      <el-table-column label="司导代收团款" align="center" prop="collectingDumpling" />
      <el-table-column label="返款" align="center" prop="reversePayment" />
      <el-table-column label="客服审核" align="center" prop="approve" />
      <el-table-column label="是否需要收款" align="center" prop="receivePayment" />
      <el-table-column label="代收费用说明" align="center" prop="collectingRemark" />
      <el-table-column label="住宿说明" align="center" prop="stayRemarks" />
      <el-table-column label="用车说明" align="center" prop="carRemarks" />
      <el-table-column label="导游说明" align="center" prop="guideRemarks" />
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="外联计调名字" align="center" prop="outreachName" />
      <el-table-column label="外联计调电话" align="center" prop="outreachPhone" /> -->
      <el-table-column label="1日" align="center" prop="date1" />
      <el-table-column label="2日" align="center" prop="date2" />
      <el-table-column label="3日" align="center" prop="date3" />
      <el-table-column label="4日" align="center" prop="date4" />
      <el-table-column label="5日" align="center" prop="date5" />
      <el-table-column label="6日" align="center" prop="date6" />
      <el-table-column label="7日" align="center" prop="date7" />
      <el-table-column label="8日" align="center" prop="date8" />
      <el-table-column label="9日" align="center" prop="date9" />
      <el-table-column label="10日" align="center" prop="date10" />
      <el-table-column label="11日" align="center" prop="date11" />
      <el-table-column label="12日" align="center" prop="date12" />
      <el-table-column label="13日" align="center" prop="date13" />
      <el-table-column label="14日" align="center" prop="date14" />
      <el-table-column label="15日" align="center" prop="date15" />
      <el-table-column label="16日" align="center" prop="date16" />
      <el-table-column label="17日" align="center" prop="date17" />
      <el-table-column label="18日" align="center" prop="date18" />
      <el-table-column label="19日" align="center" prop="date19" />
      <el-table-column label="20日" align="center" prop="date20" />
      <el-table-column label="21日" align="center" prop="date21" />
      <el-table-column label="22日" align="center" prop="date22" />
      <el-table-column label="23日" align="center" prop="date23" />
      <el-table-column label="24日" align="center" prop="date24" />
      <el-table-column label="25日" align="center" prop="date25" />
      <el-table-column label="26日" align="center" prop="date26" />
      <el-table-column label="27日" align="center" prop="date27" />
      <el-table-column label="28日" align="center" prop="date28" />
      <el-table-column label="29日" align="center" prop="date29" />
      <el-table-column label="30日" align="center" prop="date30" />
      <el-table-column label="31日" align="center" prop="date31" />
      <el-table-column label="32日" align="center" prop="date32" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template v-slot="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
                     v-hasPermi="['team:orde:update']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                     v-hasPermi="['team:orde:delete']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>
    <!-- 对话框(添加 / 修改) -->
    <OrdeForm ref="formRef" @success="getList" />
    </div>
</template>

<script>
import * as OrdeApi from '@/api/team/orde';
import OrdeForm from './OrdeForm.vue';
export default {
  name: "Orde",
  components: {
          OrdeForm
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
              // 总条数
        total: 0,
      // 团队订单列表
      list: [],
      // 是否展开，默认全部展开
      isExpandAll: true,
      // 重新渲染表格状态
      refreshTable: true,
      // 选中行
      currentRow: {},
      // 查询参数
      queryParams: {
                    pageNo: 1,
            pageSize: 10,
        numbers: null,
        lineNames: null,
        lineId: null,
        type: null,
        blocksName: null,
        arriveDate: [],
        arriveTime: [],
        returnDate: [],
        returnTime: [],
      },
            };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    async getList() {
      try {
      this.loading = true;
              const res = await OrdeApi.getOrdePage(this.queryParams);
        this.list = res.data.list;
        this.total = res.data.total;
      } finally {
        this.loading = false;
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 添加/修改操作 */
    openForm(id) {
      this.$refs["formRef"].open(id);
    },
    /** 删除按钮操作 */
    async handleDelete(row) {
      const id = row.id;
      await this.$modal.confirm('是否确认删除团队订单编号为"' + id + '"的数据项?')
      try {
       await OrdeApi.deleteOrde(id);
       await this.getList();
       this.$modal.msgSuccess("删除成功");
      } catch {}
    },
    /** 导出按钮操作 */
    async handleExport() {
      await this.$modal.confirm('是否确认导出所有团队订单数据项?');
      try {
        this.exportLoading = true;
        const data = await OrdeApi.exportOrdeExcel(this.queryParams);
        this.$download.excel(data, '团队订单.xls');
      } catch {
      } finally {
        this.exportLoading = false;
      }
    },
              }
};
</script>